home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / misc / 39 / include / hack.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-07-17  |  4.7 KB  |  172 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2. /* hack.h - version 1.0.3 */
  3.  
  4. #include "config.h"
  5.  
  6. #ifdef UNIX
  7. #ifdef BSD
  8. #include <strings.h>        /* declarations for strcat etc. */
  9. #else
  10. #include <string.h>        /* idem on System V */
  11. #define    index    strchr
  12. #define    rindex    strrchr
  13. #endif BSD
  14. #else UNIX
  15. #ifdef TOS
  16. #define index    strchr
  17. #define rindex    strrchr
  18. #endif TOS
  19. #endif UNIX
  20.  
  21. #define    Null(type)    ((struct type *) 0)
  22.  
  23. #include    "objclass.h"
  24.  
  25. typedef struct {
  26.     xchar x,y;
  27. } coord;
  28.  
  29. #include    "monst.h"    /* uses coord */
  30. #include    "gold.h"
  31. #include    "trap.h"
  32. #include    "obj.h"
  33. #include    "flag.h"
  34.  
  35. #ifndef MSDOS
  36. extern char *sprintf();
  37. #endif MSDOS
  38. #define    plur(x)    (((x) == 1) ? "" : "s")
  39.  
  40. #define    BUFSZ    256    /* for getlin buffers */
  41. #define    PL_NSIZ    32    /* name of player, ghost, shopkeeper */
  42.  
  43. #include    "rm.h"
  44. #include    "permonst.h"
  45.  
  46. extern long *alloc();
  47.  
  48. extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
  49.  
  50. extern xchar dlevel;
  51. #define    newstring(x)    (char *) alloc((unsigned)(x))
  52. #include "onames.h"
  53.  
  54. #define ON 1
  55. #define OFF 0
  56.  
  57. extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, 
  58.     *uleft, *uright, *fcobj;
  59. extern struct obj *uchain;    /* defined iff PUNISHED */
  60. extern struct obj *uball;    /* defined if PUNISHED */
  61. struct obj *o_at(), *getobj(), *sobj_at();
  62.  
  63. struct prop {
  64. #define    TIMEOUT        007777    /* mask */
  65. #define    LEFT_RING    W_RINGL    /* 010000L */
  66. #define    RIGHT_RING    W_RINGR    /* 020000L */
  67. #define    INTRINSIC    040000L
  68. #define    LEFT_SIDE    LEFT_RING
  69. #define    RIGHT_SIDE    RIGHT_RING
  70. #define    BOTH_SIDES    (LEFT_SIDE | RIGHT_SIDE)
  71.     long p_flgs;
  72.     int (*p_tofn)();    /* called after timeout */
  73. };
  74.  
  75. struct you {
  76.     xchar ux, uy;
  77.     schar dx, dy, dz;    /* direction of move (or zap or ... ) */
  78. #ifdef QUEST
  79.     schar di;        /* direction of FF */
  80.     xchar ux0, uy0;        /* initial position FF */
  81. #endif QUEST
  82.     xchar udisx, udisy;    /* last display pos */
  83.     char usym;        /* usually '@' */
  84.     schar uluck;
  85. #define    LUCKMAX        10    /* on moonlit nights 11 */
  86. #define    LUCKMIN        (-10)
  87.     int last_str_turn;
  88.     unsigned udispl;    /* @ on display */
  89.     unsigned ulevel;    /* 1 - 14 */
  90. #ifdef QUEST
  91.     unsigned uhorizon;
  92. #endif QUEST
  93.     unsigned utrap;        /* trap timeout */
  94.     unsigned utraptype;    /* defined if utrap nonzero */
  95. #define    TT_BEARTRAP    0
  96. #define    TT_PIT        1
  97.     unsigned uinshop;    /* used only in shk.c - (roomno+1) of shop */
  98.  
  99.  
  100. /* perhaps these #define's should also be generated by makedefs */
  101. #define    TELEPAT        LAST_RING        /* not a ring */
  102. #define    Telepat        u.uprops[TELEPAT].p_flgs
  103. #define    FAST        (LAST_RING+1)        /* not a ring */
  104. #define    Fast        u.uprops[FAST].p_flgs
  105. #define    CONFUSION    (LAST_RING+2)        /* not a ring */
  106. #define    Confusion    u.uprops[CONFUSION].p_flgs
  107. #define    INVIS        (LAST_RING+3)        /* not a ring */
  108. #define    Invis        u.uprops[INVIS].p_flgs
  109. #define Invisible    (Invis && !See_invisible)
  110. #define    GLIB        (LAST_RING+4)        /* not a ring */
  111. #define    Glib        u.uprops[GLIB].p_flgs
  112. #define    PUNISHED    (LAST_RING+5)        /* not a ring */
  113. #define    Punished    u.uprops[PUNISHED].p_flgs
  114. #define    SICK        (LAST_RING+6)        /* not a ring */
  115. #define    Sick        u.uprops[SICK].p_flgs
  116. #define    BLIND        (LAST_RING+7)        /* not a ring */
  117. #define    Blind        u.uprops[BLIND].p_flgs
  118. #define    WOUNDED_LEGS    (LAST_RING+8)        /* not a ring */
  119. #define Wounded_legs    u.uprops[WOUNDED_LEGS].p_flgs
  120. #define STONED        (LAST_RING+9)        /* not a ring */
  121. #define Stoned        u.uprops[STONED].p_flgs
  122. #define PROP(x) (x-RIN_ADORNMENT)       /* convert ring to index in uprops */
  123.     unsigned umconf;
  124.     char *usick_cause;
  125.     struct prop uprops[LAST_RING+10];
  126.  
  127.     unsigned uswallow;        /* set if swallowed by a monster */
  128.     unsigned uswldtim;        /* time you have been swallowed */
  129.     unsigned uhs;            /* hunger state - see eat.c */
  130.     schar ustr,ustrmax;
  131.     schar udaminc;
  132.     schar uac;
  133.     int uhp,uhpmax;
  134.     long int ugold,ugold0,uexp,urexp;
  135.     int uhunger;            /* refd only in eat.c and shk.c */
  136.     int uinvault;
  137.     struct monst *ustuck;
  138.     int nr_killed[CMNUM+2];        /* used for experience bookkeeping */
  139. };
  140.  
  141. extern struct you u;
  142.  
  143. extern char *traps[];
  144. extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(),
  145.     *doname(), *aobjnam();
  146. extern char readchar();
  147. extern char vowels[];
  148.  
  149. extern xchar curx,cury;    /* cursor location on screen */
  150.  
  151. extern coord bhitpos;    /* place where thrown weapon falls to the ground */
  152.  
  153. extern xchar seehx,seelx,seehy,seely; /* where to see*/
  154. extern char *save_cm,*killer;
  155.  
  156. extern xchar dlevel, maxdlevel; /* dungeon level */
  157.  
  158. extern long moves;
  159.  
  160. extern int multi;
  161.  
  162.  
  163. extern char lock[];
  164.  
  165.  
  166. #define DIST(x1,y1,x2,y2)       (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
  167.  
  168. #define    PL_CSIZ        20    /* sizeof pl_character */
  169. #define    MAX_CARR_CAP    120    /* so that boulders can be heavier */
  170. #define    MAXLEVEL    40
  171. #define    FAR    (COLNO+2)    /* position outside screen */
  172.